package com.ruoyi.web.controller.useradmin;

import com.ruoyi.useradmin.domain.UaAttention;
import com.ruoyi.useradmin.service.IUaAttentionService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.IdList.idList;
import io.lettuce.core.dynamic.annotation.Param;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.useradmin.domain.UaUser;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * @Description  
 * @author kemonvvv
 * @Date 2023-06-05 
 */
@RestController
@RequestMapping("useradmin/uaAttention")
public class UaAttentionController extends BaseController {

    @Resource
    private IUaAttentionService uaAttentionService;
    /**
     * 通过全查询
     *  params是用若依的特殊处理过的，不能直接用url去测试，只能用若依的主键写代码去测试
     */
    @PreAuthorize("@ss.hasPermi('useradmin:uaAttention:query')")
    @PostMapping("/getUaAttentionPage")
    public AjaxResult getUaAttentionPage(@RequestBody PageDomain pageDomain,@RequestBody UaAttention uaAttention ,@RequestBody UaUser uaUser2) {
        Object data = uaAttentionService.getUaAttentionPage(pageDomain, uaAttention, uaUser2);
        return AjaxResult.success(data);
    }

    /**
     * 通过查询全部
     */
    @PreAuthorize("@ss.hasPermi('useradmin:uaAttention:query')")
    @PostMapping("/getUaAttentionList")
    public AjaxResult getUaAttentionList() {
        Object data = uaAttentionService.getUaAttentionList();
        return AjaxResult.success(data);
    }
    
    /**
     * 通过id查询
     */
    @PreAuthorize("@ss.hasPermi('useradmin:uaAttention:query')")
    @PostMapping("/getUaAttentionById")
    public AjaxResult getUaAttentionById(@RequestBody Map<String,Long> idMap) {
        Object data = uaAttentionService.getUaAttentionById(idMap.get("id"));
        return AjaxResult.success(data);
    }

    /**
     * 添加
     */
    @PreAuthorize("@ss.hasPermi('useradmin:uaAttention:add')")
    @PostMapping("/insertUaAttention")
    public AjaxResult insertUaAttention(@RequestBody UaAttention uaAttention) {
        Object data = uaAttentionService.insertUaAttention(uaAttention);
        return AjaxResult.success(data);
    }

    /**
     * 更新
     */
    @PreAuthorize("@ss.hasPermi('useradmin:uaAttention:edit')")
    @PostMapping("/updateUaAttention")
    public AjaxResult updateUaAttention(@RequestBody UaAttention uaAttention) {
        Object data = uaAttentionService.updateUaAttentionById(uaAttention);
        return AjaxResult.success(data);
    }

    /**
     * 删除
     */
    @PreAuthorize("@ss.hasPermi('useradmin:uaAttention:remove')")
    @PostMapping("/deleteUaAttentionByIdList")
    public AjaxResult deleteUaAttentionByIdList(@RequestBody idList idList) {
        Object data = uaAttentionService.deleteUaAttentionByIdList(idList.getIdList());
        return AjaxResult.success(data);
    }

}
